package com.springboot.rigger;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @title: TestBean
 * @Author Star_Chen
 * @Date: 2023/7/17 15:57
 * @Version 1.0
 */
@Component
public class TestBean implements ApplicationContextAware {

    @Autowired
    private ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames();
        for (String beanDefinitionName : beanDefinitionNames) {
            if (beanDefinitionName.startsWith("jdbc")){
                System.out.println(beanDefinitionName);
            }
        }
    }
}
